package com.io.example.demoparent.ES.es;


import com.io.example.demoparent.ES.util.ESUtil;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/*
    查询索引
 */
public class ES_Index_Delete {

    public static void main(String[] args) throws IOException {
        RestHighLevelClient restHighLevelClient = ESUtil.esRestClient( );
        DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest( "user");
        AcknowledgedResponse response = restHighLevelClient.indices( ).delete(deleteIndexRequest, RequestOptions.DEFAULT);
        boolean acknowledged = response.isAcknowledged( );

        System.out.println("acknowledged = " + acknowledged);

        restHighLevelClient.close();
    }
}
